package com.thon.dao.paper.impl;

import com.thon.commons.persistence.BaseDaoImpl;
import com.thon.dao.paper.RelationDao;
import com.thon.entity.paper.Relation;
import org.springframework.stereotype.Repository;

import java.util.List;

/**
 * Created by Chen on 2016/2/23.
 */
@Repository
public class RelationDaoImpl extends BaseDaoImpl<Relation> implements RelationDao{

    public RelationDaoImpl() {
        super(Relation.class);
    }

    @Override
    public List<Relation> getByStudentId(int studentId) {
        String queryString  = "FROM relation r WHERE r.student.id = ?";
        return findList(queryString, studentId);
    }

    @Override
    public Relation getRelationIdByStudentId(int uid) {
        String queryString = "FROM relation r WHERE r.student.id = ?";
        return findOne(queryString, uid);
    }
}
